<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .ulClass {
            background-color: rgb(231, 8, 8);
        }
    </style>
</head>

<body>
    <input type="button" value="改变列表颜色" id="bn">
    <ul id="ulId" class="">
        <li>11</li>
        <li>22</li>
        <li>33</li>
        <li>44</li>
        <li>55</li>
    </ul>
    <script>
        function my$(id) {
            return document.getElementById(id);
        }
        my$("bn").onclick = function () {
            my$("ulId").className = my$("ulId").className == "ulClass" ? "" : "ulClass";
        }
    </script>
</body>

</html>